<template>
	<u-card :title="title" >
		<view class="" slot="body">
			<u-grid :col="1">
				<u-grid-item @tap="clickCoupon(1)">
					<u-icon name="coupon" :size="50"></u-icon>
					<view class="grid-text">人工库出库</view>
				</u-grid-item>
				<u-grid-item @tap="clickCoupon(2)">
					<u-icon name="coupon" :size="50"></u-icon>
					<view class="grid-text">人工库入库</view>
				</u-grid-item>
			</u-grid>
		</view>
	</u-card>
</template>

<script>
	export default {
		data() {
			return {
				title: '操作功能'
			}
		},
		onLoad() {

		},
		methods: {
			clickCoupon(date){
				console.log("clickCoupon")
				if(this.hasLogin()){
					if(date==1){
						this.$u.route("pages/Location/Location")
					}else if(date==2){
						this.$u.route("pages/outbound/outbound")
					}
				}else{
					this.$t.message.loading('登录失效请重新登录')
					setTimeout(()=>{
						
						this.$t.message.closeLoading()
						this.$u.route({
							type:'reLaunch',
							url:'pages/login/login'
						})
						// this.$Router.replace({name:"tabbar"})
					},1300)
				}
			},
			lock(){
				console.log("lock")
				if(this.hasLogin()){
					this.$u.route("pages/feeding/feeding")
				}else{
					this.$t.message.loading('登录失效请重新登录')
					setTimeout(()=>{
						
						this.$t.message.closeLoading()
						this.$u.route({
							type:'reLaunch',
							url:'pages/login/login'
						})
						// this.$Router.replace({name:"tabbar"})
					},1300)
				}
			},
			
			//判断是否登录
			hasLogin(){
				let haslogin= uni.getStorageSync('jo_user')
				if(haslogin==null||haslogin==""){
					return false
				}
				else{
					return true
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.grid-text {
		font-size: 28rpx;
		margin-top: 4rpx;
		color: $u-type-info;
	}
</style>
